USE [OctoNetApps]
GO

/****** Object:  StoredProcedure [classified].[ClassifiedAttributes_Delete]    Script Date: 05/25/2011 06:59:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO







CREATE PROCEDURE [classified].[ClassifiedAttributes_Delete]
	@CategoryID bigint,
	@AttributeID bigint
AS
BEGIN

	SET NOCOUNT ON;
	
	BEGIN TRY
	
		BEGIN TRANSACTION TR
	
	DELETE FROM classified.ClassifiedAdsAttributeValues
	WHERE CategoryID = @CategoryID AND AttributeID = @AttributeID
	
	DELETE FROM classified.ClassifiedAdsCustomAttributeValues
	WHERE CategoryID = @CategoryID AND AttributeID = @AttributeID
	
	DELETE FROM classified.ClassifiedAttributeValues
	WHERE CategoryID = @CategoryID AND AttributeID = @AttributeID
	
    DELETE FROM classified.ClassifiedAttributes
	WHERE CategoryID = @CategoryID AND AttributeID = @AttributeID
	
	COMMIT TRANSACTION TR
    END TRY
    BEGIN CATCH
		ROLLBACK TRANSACTION TR
    END CATCH
END





GO


